package com.xczl.job.test;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.xczl.job.entity.Job;
import com.xczl.job.service.JobService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({ "classpath:applicationContext.xml" })
public class JobTestCase {

	@Resource(name = "jobJobService")
	private JobService jobService;

	@Test
	public void add() {
		Job job = createJob();
		jobService.add(job);
	}

	private Job createJob() {
		Job job = new Job();
		job.setCert("无");
		job.setCollectionLocation("金阳世纪城");
		job.setCollectionTime(new Date());
		job.setCycle(3);
		job.setDeadline(new Date());
		job.setDetails("内容");
		job.setGender(2);
		job.setHeightDemand("无");
		job.setPay(BigDecimal.valueOf(100));
		job.setTotalPeople(100);
		job.setTitle("发传单123");
		job.setWelfare("提成10");
		job.setWorkData("周六 周日");
		job.setWorkPlace("世纪城");
		job.setWorkTime("8:00-15:00");
		return job;
	}

	@Test
	public void findList() {
		Job search = new Job();
		search.setCycle(1);
		search.setPay(BigDecimal.valueOf(1000));
		List<Job> list = jobService.findListBySearch(search, 0, 100);
		for (Job job : list) {
			System.out.println(job.getJobId() + job.getTitle());
		}
	}
	@Test
	public void del() {
		Job search = new Job();
		search.setJobId(15);
		jobService.del(search.getJobId());
		
		
	}
	@Test
	public void deadline(){
		Job search = new Job();
		search.setJobId(16);
		search.setDeadline(new Date());
		jobService.deadline(search);
	}
	@Test
	public void update(){
		Job search = new Job();
		search.setJobId(19);
		search.setTotalPeople(150);
		jobService.update(search);
		
		
	}
	@Test
	public void updateActualPeople(){
		Job search = new Job();
		search.setJobId(22);
		search.setActualPeople(150);
		jobService.updateActualPeople(search);
	}
	

}
